Optimal. Leaf size=76 \[ -\frac {2 (A b-a B) \text {ArcTan}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a \sqrt {a-b} \sqrt {a+b} d}+\frac {A \tanh ^{-1}(\sin (c+d x))}{a d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.07, antiderivative size = 76, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.138, Rules used = {3080, 3855,
2738, 211} \begin {gather*} \frac {A \tanh ^{-1}(\sin (c+d x))}{a d}-\frac {2 (A b-a B) \text {ArcTan}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a d \sqrt {a-b} \sqrt {a+b}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 211
Rule 2738
Rule 3080
Rule 3855
Rubi steps
\begin {align*} \int \frac {(A+B \cos (c+d x)) \sec (c+d x)}{a+b \cos (c+d x)} \, dx &=\frac {A \int \sec (c+d x) \, dx}{a}+\frac {(-A b+a B) \int \frac {1}{a+b \cos (c+d x)} \, dx}{a}\\ &=\frac {A \tanh ^{-1}(\sin (c+d x))}{a d}-\frac {(2 (A b-a B)) \text {Subst}\left (\int \frac {1}{a+b+(a-b) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{a d}\\ &=-\frac {2 (A b-a B) \tan ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a \sqrt {a-b} \sqrt {a+b} d}+\frac {A \tanh ^{-1}(\sin (c+d x))}{a d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.18, size = 112, normalized size = 1.47 \begin {gather*} \frac {\frac {2 (A b-a B) \tanh ^{-1}\left (\frac {(a-b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {-a^2+b^2}}\right )}{\sqrt {-a^2+b^2}}+A \left (-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )}{a d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.38, size = 92, normalized size = 1.21
method | result | size |
derivativedivides | \(\frac {\frac {A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a}+\frac {2 \left (-A b +a B \right ) \arctan \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a \sqrt {\left (a -b \right ) \left (a +b \right )}}-\frac {A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{a}}{d}\) | \(92\) |
default | \(\frac {\frac {A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a}+\frac {2 \left (-A b +a B \right ) \arctan \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a \sqrt {\left (a -b \right ) \left (a +b \right )}}-\frac {A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{a}}{d}\) | \(92\) |
risch | \(-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+a \sqrt {-a^{2}+b^{2}}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) A b}{\sqrt {-a^{2}+b^{2}}\, d a}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+a \sqrt {-a^{2}+b^{2}}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) B}{\sqrt {-a^{2}+b^{2}}\, d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) A b}{\sqrt {-a^{2}+b^{2}}\, d a}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) B}{\sqrt {-a^{2}+b^{2}}\, d}+\frac {A \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d a}-\frac {A \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d a}\) | \(327\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.74, size = 304, normalized size = 4.00 \begin {gather*} \left [\frac {{\left (B a - A b\right )} \sqrt {-a^{2} + b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) + {\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cos \left (d x + c\right ) + b\right )} \sin \left (d x + c\right ) - a^{2} + 2 \, b^{2}}{b^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + a^{2}}\right ) + {\left (A a^{2} - A b^{2}\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (A a^{2} - A b^{2}\right )} \log \left (-\sin \left (d x + c\right ) + 1\right )}{2 \, {\left (a^{3} - a b^{2}\right )} d}, \frac {2 \, {\left (B a - A b\right )} \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \cos \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \sin \left (d x + c\right )}\right ) + {\left (A a^{2} - A b^{2}\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (A a^{2} - A b^{2}\right )} \log \left (-\sin \left (d x + c\right ) + 1\right )}{2 \, {\left (a^{3} - a b^{2}\right )} d}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\left (A + B \cos {\left (c + d x \right )}\right ) \sec {\left (c + d x \right )}}{a + b \cos {\left (c + d x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.48, size = 127, normalized size = 1.67 \begin {gather*} \frac {\frac {A \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a} - \frac {A \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a} + \frac {2 \, {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, a - 2 \, b\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {a^{2} - b^{2}}}\right )\right )} {\left (B a - A b\right )}}{\sqrt {a^{2} - b^{2}} a}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.60, size = 342, normalized size = 4.50 \begin {gather*} \frac {2\,A\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{a\,d}+\frac {b\,\left (A\,\ln \left (\frac {a\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )+b\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\sqrt {-\left (a+b\right )\,\left (a-b\right )}-A\,\ln \left (\frac {a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\sqrt {b^2-a^2}\right )-B\,a\,\ln \left (\frac {a\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )+b\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\sqrt {-\left (a+b\right )\,\left (a-b\right )}+B\,a\,\ln \left (\frac {a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\sqrt {b^2-a^2}}{a\,d\,\left (a^2-b^2\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________